<?php
namespace Fc;


class FcService {
    private $client;
    public function __construct(SDKClient $client) {
        $this->client = $client;
    }

    function ListTriggers(string $functionName, array $ListTriggersRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/triggers";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

         if (!$functionName) {
             return new \Exception("函数名不能为空");
        }

         $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $ListTriggersRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

     function GetTrigger(string $functionName, string $triggerName, array $GetTriggerRequest, array $header)
     {
         $url = "/openapi/v1/functions/$functionName/triggers/$triggerName";
         $allHeaders = ['Content-Type' => 'application/json'] + $header;
         $method = 'GET';

         if ((!$functionName) || (!$triggerName)) {
             return new \Exception("函数名或触发器名不能为空");
         }

         $config = [
             'method' => $method,
             'url' => $url,
             'headers' => $allHeaders,
             'query' => $GetTriggerRequest,
             'json' => null,
             'data' => null,
         ];

         try {
             return $this->client->doRequest($config);
         } catch (\Exception $e) {
             return $e->getMessage();
         }
     }

    function CreateTrigger(string $functionName, array $CreateTriggerRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/triggers";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';

        if (!$functionName)  {
            return new \Exception("函数名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $CreateTriggerRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function UpdateTrigger(string $functionName, string $triggerName, array $UpdateTriggerRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/triggers/$triggerName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'PUT';

        if ((!$functionName) || (!$triggerName)) {
            return new \Exception("函数名或触发器名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $UpdateTriggerRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteTrigger(string $functionName, string $triggerName, array $DeleteTriggerRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/triggers/$triggerName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';

        if ((!$functionName) || (!$triggerName)) {
            return new \Exception("函数名或触发器名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $DeleteTriggerRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function CreateAlias(string $functionName, array $createAliasRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/aliases";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';

        if (!$functionName) {
            return new \Exception("函数名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $createAliasRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function UpdateAlias(string $functionName, string $aliasName, array $updateAliasRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/aliases/$aliasName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'PUT';

        if (!$functionName || !$aliasName) {
            return new \Exception("函数名或别名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $updateAliasRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteAlias(string $functionName, string $aliasName, array $deleteAliasRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/aliases/$aliasName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';

        if (!$functionName || !$aliasName) {
            return new \Exception("函数名或别名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $deleteAliasRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetAlias(string $functionName, string $aliasName, array $getAliasRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/aliases/$aliasName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

        if (!$functionName || !$aliasName) {
            return new \Exception("函数名或别名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getAliasRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListAsyncTasks(string $functionName, array $listAsyncTasksRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/async-tasks";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

        if (!$functionName) {
            return new \Exception("函数名不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listAsyncTasksRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetAsyncTask(string $functionName, string $taskId, array $getAsyncTaskRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/async-tasks/$taskId";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

        if (!$functionName || !$taskId) {
            return new \Exception("函数名或任务id不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getAsyncTaskRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function StopAsyncTask(string $functionName, string $taskId, array $stopAsyncTaskRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/async-tasks/$taskId/stop";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'PUT';

        if (!$functionName || !$taskId) {
            return new \Exception("函数名或任务id不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $stopAsyncTaskRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function CreateLayerVersion(string $layerName, array $createLayerVersionRequest, array $header)
    {
        $url = "/openapi/v1/layers/$layerName/versions";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';

        if (!$layerName) {
            return new \Exception("层名称不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $createLayerVersionRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetLayerVersion(string $layerName, string $version, array $getLayerVersionRequest, array $header)
    {
        $url = "/openapi/v1/layers/$layerName/versions/$version";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

        if (!$layerName) {
            return new \Exception("层名称不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getLayerVersionRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetLayerVersionByCtrn(string $ctrn, array $getLayerVersionByCtrnRequest, array $header)
    {
        $url = "/openapi/v1/layerctrn/$ctrn";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

        if (!$ctrn) {
            return new \Exception("ctrn不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getLayerVersionByCtrnRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListLayerVersions(string $layerName, array $listLayerVersionsRequest, array $header)
    {
        $url = "/openapi/v1/layers/$layerName/versions";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

        if (!$layerName) {
            return new \Exception("层名称不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listLayerVersionsRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListLayers(string $layerName, array $listLayersRequest, array $header)
    {
        $url = "/openapi/v1/layers";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';

        if (!$layerName) {
            return new \Exception("层名称不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listLayersRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function PutLayerACL(string $layerName, array $putLayerACLRequest, array $header)
    {
        $url = "/openapi/v1/layers/$layerName/acl";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';

        if (!$layerName) {
            return new \Exception("层名称不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $putLayerACLRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteLayerVersion(string $layerName, string $version, array $deleteLayerRequest, array $header)
    {
        $url = "/openapi/v1/layers/$layerName/versions/$version";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';

        if (!$layerName) {
            return new \Exception("层名称不能为空");
        }

        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $deleteLayerRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    // 创建、设置函数并发配额
    function PutConcurrencyConfig(array $putConcurrencyConfigRequest, array $header) {
        $url = "/openapi/v1/resources/reservedConcurrency";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'PUT';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $putConcurrencyConfigRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetConcurrencyConfig($functionName, array $getConcurrencyConfigRequest, array $header)
    {
        $url = "/openapi/v1/resources/functions/$functionName/reservedConcurrency";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getConcurrencyConfigRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }

    }

    function ListConcurrencyConfig(array $listConcurrencyConfigRequest, array $header)
    {
        $url = "/openapi/v1/resources/functions/reservedConcurrency";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listConcurrencyConfigRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }

    }

    function DeleteConcurrencyConfig(string $functionName, array $deleteConcurrencyConfigRequest, array $header)
    {
        $url = "/openapi/v1/resources/functions/$functionName/concurrency";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $deleteConcurrencyConfigRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }

    }

    function PutProvisionConfig(string $functionName, array $putProvisionConfigRequest, array $header)
    {
        $url = "/openapi/v1/resources/functions/$functionName/provision-config";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'PUT';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $putProvisionConfigRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }

    }

    function GetProvisionConfig(string $functionName, array $getProvisionConfigRequest, array $header)
    {
        $url = "/openapi/v1/resources/functions/$functionName/provision-config";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getProvisionConfigRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListProvisionConfigs(array $listProvisionConfigsRequest, array $header)
    {
        $url = "/openapi/v1/resources/provision-configs";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listProvisionConfigsRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteProvisionConfig(string $functionName, array $deleteProvisionConfigRequest, array $header) {
        $url = "/openapi/v1/resources/functions/$functionName/provision-config";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $deleteProvisionConfigRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetAsyncInvokeConfig(string $functionName, array $asyncInvokeConfigRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/async";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $asyncInvokeConfigRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListAsyncInvokeConfigs(array $listAsyncInvokeConfigsRequest, array $header) {
        $url = "/openapi/v1/async-configs";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listAsyncInvokeConfigsRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteAsyncInvokeConfig(string $functionName, array $deleteAsyncInvokeConfigRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/async";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $deleteAsyncInvokeConfigRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function PutAsyncInvokeConfig(string $functionName, array $putAsyncInvokeConfigRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/async";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $putAsyncInvokeConfigRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function CreateCustomDomain(array $createCustomDomainRequest, array $header) {
        $url = "/openapi/v1/domains/customdomains";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $createCustomDomainRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListCustomDomains(array $listCustomDomainsRequest, array $header) {
        $url = "/openapi/v1/domains/customdomains";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listCustomDomainsRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteCustomDomain(string $domainName, array $deleteCustomDomainRequest, array $header)
    {
        $url = "/openapi/v1/domains/customdomains/$domainName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $deleteCustomDomainRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function UpdateCustomDomain(string $domainName, array $updateCustomDomainRequest, array $header)
    {
        $url = "/openapi/v1/domains/customdomains/$domainName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'PUT';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $updateCustomDomainRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetCustomDomain(string $domainName, array $getCustomDomainRequest, array $header) {
        $url = "/openapi/v1/domains/customdomains/$domainName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getCustomDomainRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteFunction(string $functionName, array $deleteFunctionRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $deleteFunctionRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetFunctionCode(string $functionName, array $getFunctionCodeRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName/code";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getFunctionCodeRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListVpcBindings(string $functionName, array $listVpcBindingsRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/vpc-bindings";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listVpcBindingsRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListInstance(array $listInstanceRequest, array $header) {
        $url = "/openapi/v1/observability/listInstances";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $listInstanceRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListFunctionVersions(string $functionName, array $listFunctionVersionsRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/versions";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listFunctionVersionsRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function PublishFunctionVersion(string $functionName, array $publishFunctionVersionRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/versions";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $publishFunctionVersionRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    // InvokeFunction 适用于同步调用且函数响应比较快的场景，响应事件超过30s的，请不要同步调用
    function InvokeFunction(string $functionName, array $invokeFunctionRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/invocations";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $invokeFunctionRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function DeleteFunctionVersion(string $functionName, string $version, array $deleteFunctionVersionRequest, array $header) {
        $url = "/openapi/v1/functions/$functionName/versions/$version";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'DELETE';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $deleteFunctionVersionRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function GetFunction(string $functionName, array $getFunctionVersionRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $getFunctionVersionRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function ListFunctions(array $listFunctionsRequest, array $header)
    {
        $url = "/openapi/v1/functions";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'GET';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $listFunctionsRequest,
            'json' => null,
            'data' => null,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function UpdateFunction(string $functionName, array $updateFunctionParams, array $updateFunctionRequest, array $header)
    {
        $url = "/openapi/v1/functions/$functionName";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'PUT';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => $updateFunctionParams,
            'json' => null,
            'data' => $updateFunctionRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

    function CreateFunction(array $createFunctionRequest, array $header)
    {
        $url = "/openapi/v1/functions";
        $allHeaders = ['Content-Type' => 'application/json'] + $header;
        $method = 'POST';


        $config = [
            'method' => $method,
            'url' => $url,
            'headers' => $allHeaders,
            'query' => null,
            'json' => null,
            'data' => $createFunctionRequest,
        ];

        try {
            return $this->client->doRequest($config);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }

}